<template>
  <el-form label-width="100px" class="wrap">
    <div class="title">支持wegame modId查询<br/>
      如一个mod代号为workshop-100010018<br/>
      则可以在这里输入 100010018 进行查询</div>
    <el-form-item class="id-input">
      <el-input v-model="form.modid" label="">
        <template #append>
          <el-button @click="search" type="primary" plain>查找</el-button>
        </template>
      </el-input>
    </el-form-item>

  </el-form>

</template>

<script lang="ts" setup>
import { reactive, ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
const electronAPI = window.electronAPI


const form = reactive({
  modid: '',
})

const search = () => {
  form.modid = form.modid.trim()

  if (!form.modid || !(/^\d+?$/.test(form.modid)) ) {
    ElMessageBox.alert('请输入正确的id', '请确认', {
      confirmButtonText: '好的',
    })
    return
  }
  const filePath = electronAPI.openSearchWin(form.modid)
}

</script>

<style>
  .id-input{
    width: 500px;
    margin: 50px auto;
  }

</style>

